package com.zeratul.common.core.utils;

import com.zeratul.common.core.stype.ServerType;
import com.zeratul.common.core.stype.ServerTypeHandler;
import com.zeratul.common.core.utils.spring.SpringUtils;

/**
 * 服务相关工具类
 */
public class ServerUtils {

    private static ServerTypeHandler serverTypeHandler = SpringUtils.getBean(ServerTypeHandler.class);

    /**
     * 判断当前是否为微服务
     */
    public static boolean isMicroService() {
        return serverTypeHandler.getServerType() == ServerType.MICROSERVICE;
    }

    /**
     * 判断当前是否为单体服务
     */
    public static boolean isMonolithic() {
        return serverTypeHandler.getServerType() == ServerType.MONOLITHIC;
    }
}
